package com.huawei.appmarket.service.distribution.minidetail;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appmarket.R;
import com.huawei.appmarket.service.appdetail.view.card.DetailHeadCard;
import com.huawei.appmarket.service.distribution.minidetail.MiniDetailFragmentProtocol.Request;
import huawei.widget.HwButton;
import java.util.ArrayList;
import java.util.List;
import o.cjk;
import o.cjm;
import o.cjo;
import o.dph;
import o.drj;

public abstract class MiniDetailAbstractFragment extends TaskFragment<MiniDetailFragmentProtocol> implements OnClickListener {
    protected HwButton ˊ;
    protected DownloadButton ˋ;
    protected DetailHeadCard ˏ;
    protected Request ॱ;

    protected abstract void ˎ(Bundle bundle);

    protected abstract void ˏ(@NonNull LayoutInflater layoutInflater, @Nullable Bundle bundle, ViewGroup viewGroup);

    public void ˏ(Bundle bundle) {
        MiniDetailFragmentProtocol miniDetailFragmentProtocol = (MiniDetailFragmentProtocol) ˆ();
        if (miniDetailFragmentProtocol == null || miniDetailFragmentProtocol.ˊ() == null) {
            this.ॱ = new Request();
        } else {
            this.ॱ = miniDetailFragmentProtocol.ˊ();
        }
        ˎ(bundle);
        super.ˏ(bundle);
    }

    @Nullable
    public View ˋ(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        ViewGroup viewGroup2 = (ViewGroup) layoutInflater.inflate(R.layout.distribution_mini_detail_fragment, viewGroup, false);
        ˎ(viewGroup, bundle, viewGroup2);
        ˏ(layoutInflater, bundle, viewGroup2);
        ॱ(viewGroup2);
        return viewGroup2;
    }

    protected void ˎ(@Nullable ViewGroup viewGroup, @Nullable Bundle bundle, ViewGroup viewGroup2) {
        LinearLayout linearLayout = (LinearLayout) viewGroup2.findViewById(R.id.mini_detail_head);
        this.ˏ = new DetailHeadCard();
        this.ˏ.ˏ(this);
        View ˊ = this.ˏ.ˊ(ˋˊ(), viewGroup, bundle);
        List arrayList = new ArrayList();
        arrayList.add(this.ॱ.ˏ());
        this.ˏ.ˊ(arrayList);
        linearLayout.addView(ˊ);
    }

    protected void ॱ(ViewGroup viewGroup) {
        this.ˊ = (HwButton) viewGroup.findViewById(R.id.mini_more_detail_button);
        this.ˊ.setOnClickListener(this);
        this.ˋ = (DownloadButton) viewGroup.findViewById(R.id.mini_download_button);
        this.ˋ.setParam(this.ॱ.ˊ());
        this.ˋ.ॱ();
    }

    public void onClick(View view) {
        if (view.getId() == R.id.mini_more_detail_button) {
            String ˏ;
            cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
            AppDetailActivityProtocol.Request request = new AppDetailActivityProtocol.Request();
            String ॱـ = this.ॱ.ˊ().ॱـ();
            if (TextUtils.isEmpty(ॱـ)) {
                ˏ = drj.ˏ(this.ॱ.ˊ().ͺˏ());
            } else {
                ˏ = drj.ॱ(ॱـ);
                request.ͺ(dph.ˋ().ˊ(ॱـ));
            }
            request.ˋ(ˏ);
            request.ˎ(true);
            request.ॱˊ(this.ॱ.ˊॱ());
            appDetailActivityProtocol.ˏ(request);
            cjk.ˎ().ˋ(ॱˊ(), new cjm("appdetail.activity", appDetailActivityProtocol));
        }
    }
}
